@extends('store::layout')
@push('styles')
    <link href="{{asset(config('store.theme.theme2').'/vendor/bootstrap/dataTables.bootstrap4.min.css')}}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
    <div class="row">
        <div class="col-12">
            @component('store::component.table.table_tpl')
                @slot('page_title'){{$page_title}}@endslot
                @slot('tool_l_btn')
                        @component('store::component.form.button')
                            @slot('title') 添加地址 @endslot
                            @slot('icon') hcl-html-add @endslot
                            @slot('class') modal-box  @endslot
                            @slot('params') {"area":"600px,500px","url":"{{route('Store_DeliveryAddress_create')}}"}  @endslot
                        @endcomponent
                @endslot
                @if($list->isNotEmpty())
                    @slot('table')
                        <table class="list table table-bordered table-striped">
                            <thead><tr role="row">
                                <td>
                                    @component('store::component.checkbox')
                                        @slot('name') ids-all @endslot
                                    @endcomponent
                                </td>
                                <th>是否默认</th><th>联系人</th> <th>发货地址</th>
                                <th>联系方式</th><th>邮编</th><th>操作</th>
                            </tr></thead>
                            <tbody>
                            @foreach($list as $item)
                                <tr role="row" class="odd">
                                    <td>
                                        @component('store::component.checkbox')
                                            @slot('name') addr_id[] @endslot
                                            @slot('class') id @endslot
                                            @slot('value') {{$item->id}} @endslot
                                        @endcomponent
                                    </td>
                                    <td>
                                        @component("store::component.switch")
                                            @slot('on') 是 @endslot
                                            @slot('off') 否 @endslot
                                            @slot('params')
                                                {"reload":true,"url":"{{route('Store_DeliveryAddress_setDefault',['addr_id'=>$item->id])}}"}
                                            @endslot
                                            @slot('checked') @if($item->is_default == 1) checked @endif @endslot
                                        @endcomponent
                                    </td>
                                    <td>{{$item->consignor}}</td>
                                    <td>{{get_address($item->area)}} {{$item->address??''}}</td>
                                    <td>{{$item->phone}}</td>
                                    <td>{{$item->zip_code ?? ''}}</td>
                                    <td>
                                        @component('store::component.form.button')
                                            @slot('title') 编辑 @endslot
                                            @slot('icon') hcl-edit1 @endslot
                                            @slot('class') modal-box  @endslot
                                            @slot('params') {"area":"600px,500px","url":"{{route('Store_DeliveryAddress_update',['addr_id'=>$item->id])}}"}  @endslot
                                        @endcomponent
                                        @component('store::component.form.button')
                                            @slot('title') 删除 @endslot
                                            @slot('color') danger @endslot
                                            @slot('icon') hcl-status-error @endslot
                                            @slot('class') btn-ajax @endslot
                                            @slot('params') {"url":"{{route('Store_DeliveryAddress_delete',['addr_id'=>$item->id])}}","confirm":true} @endslot
                                        @endcomponent

                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    @endslot
                @else
                    @slot('table')
                        @component('store::public.empty')
                            @slot('info') 暂时没有发货地址 @endslot
                        @endcomponent
                    @endslot
                @endif
            @endcomponent
        </div> <!-- end col -->
    </div>
@endsection
@push('scripts')
    <script src="{{asset(config('store.plugin').'/layui/check-all.js')}}"></script>
@endpush